package cn.hxzy.controller;

import cn.hxzy.common.R;
import cn.hxzy.entity.Train;
import cn.hxzy.service.TrainService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yuankan.WANG
 * @since 2022-01-13
 */
@CrossOrigin
@RestController
@RequestMapping("/train")
public class TrainController {
    @Autowired
    private TrainService trainService;

    @PostMapping("/sel")
    public R sel(){
        return trainService.sel();
    }

    @PostMapping("/add")
    public R add(@RequestBody Train train){
        return trainService.add(train);
    }

    @PostMapping("/update1")
    public R update1(@RequestBody Train train){
        return trainService.update1(train);
    }

    @PostMapping("/upd1")
    public R upd1(@RequestBody Train train) {
        return trainService.upd1(train.getTrainId());
    }

    @PostMapping("/upd2")
    public R upd2(@RequestBody Train train) {
        return trainService.upd2(train.getTrainId());
    }

//    @PostMapping("/del")
//    public Boolean del(@RequestParam("trainId") Integer trainId){return trainService.del(trainId);}


}
